package axelrod;

public class JOSAgent implements AxelrodAgent {
    private final int frequency = 10;
    private int step;
    
    /** Defects every 10 moves. Else plays TIT-FOR-TAT.
     */
    public JOSAgent() {
      step = 0;
    }
    
    public int getMove(int currentTurn, int opponentMove) {
        step++;
        if(currentTurn == 0) {
            return Environment.MOVE_COOPERATE;
        } else {
            //periodically defect
            if(step == frequency) {
                step = 0;
                return Environment.MOVE_DEFECT;
            } else {
                return opponentMove;
            }
        }
    }

    public void startMatch() {
    }
}
